package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DeliveryOrderInfoMapper;
import com.ruoyi.system.domain.DeliveryOrderInfo;
import com.ruoyi.system.service.IDeliveryOrderInfoService;
import com.ruoyi.common.core.text.Convert;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 出库领料详情Service业务层处理
 *
 * @author tanshen
 * @date 2023-08-24
 */
@Service
public class DeliveryOrderInfoServiceImpl extends ServiceImpl<DeliveryOrderInfoMapper, DeliveryOrderInfo> implements IDeliveryOrderInfoService {
    @Autowired
    private DeliveryOrderInfoMapper deliveryOrderInfoMapper;

    /**
     * 查询出库领料详情
     *
     * @param id 出库领料详情主键
     * @return 出库领料详情
     */
    @Override
    public DeliveryOrderInfo selectDeliveryOrderInfoById(Long id) {
        return deliveryOrderInfoMapper.selectDeliveryOrderInfoById(id);
    }

    /**
     * 查询出库领料详情列表
     *
     * @param deliveryOrderInfo 出库领料详情
     * @return 出库领料详情
     */
    @Override
    public List<DeliveryOrderInfo> selectDeliveryOrderInfoList(DeliveryOrderInfo deliveryOrderInfo) {
        return deliveryOrderInfoMapper.selectDeliveryOrderInfoList(deliveryOrderInfo);
    }

    /**
     * 新增出库领料详情
     *
     * @param deliveryOrderInfo 出库领料详情
     * @return 结果
     */
    @Override
    public int insertDeliveryOrderInfo(DeliveryOrderInfo deliveryOrderInfo) {
        deliveryOrderInfo.setCreateTime(DateUtils.getNowDate());
        return deliveryOrderInfoMapper.insertDeliveryOrderInfo(deliveryOrderInfo);
    }

    /**
     * 修改出库领料详情
     *
     * @param deliveryOrderInfo 出库领料详情
     * @return 结果
     */
    @Override
    public int updateDeliveryOrderInfo(DeliveryOrderInfo deliveryOrderInfo) {
        deliveryOrderInfo.setUpdateTime(DateUtils.getNowDate());
        return deliveryOrderInfoMapper.updateDeliveryOrderInfo(deliveryOrderInfo);
    }

    /**
     * 批量删除出库领料详情
     *
     * @param ids 需要删除的出库领料详情主键
     * @return 结果
     */
    @Override
    public int deleteDeliveryOrderInfoByIds(String ids) {
        return deliveryOrderInfoMapper.deleteDeliveryOrderInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除出库领料详情信息
     *
     * @param id 出库领料详情主键
     * @return 结果
     */
    @Override
    public int deleteDeliveryOrderInfoById(Long id) {
        return deliveryOrderInfoMapper.deleteDeliveryOrderInfoById(id);
    }
}